# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=geoclue
pkgver=2.7.2
pkgrel=0
pkgdesc="dbus geolocation service"
url="https://gitlab.freedesktop.org/geoclue/geoclue/-/wikis/home"
arch="all"
license="LGPL-2.1-or-later"
makedepends="
	avahi-dev
	gobject-introspection-dev
	json-glib-dev
	libnotify-dev
	libsoup3-dev
	meson
	vala
	"
subpackages="$pkgname-dev $pkgname-doc"
install="$pkgname.pre-install"
source="https://gitlab.freedesktop.org/geoclue/geoclue/-/archive/$pkgver/geoclue-$pkgver.tar.bz2"

case "$CARCH" in
	s390x|riscv64)
		_arch_opts="-D3g-source=false -Dcdma-source=false -Dmodem-gps-source=false"
		;;
	*)
		_arch_opts=""
		makedepends="$makedepends modemmanager-dev"
		;;
esac

build() {
	abuild-meson \
		-Db_lto=true \
		-Ddbus-srv-user=geoclue \
		-Ddbus-sys-dir=/usr/share/dbus-1/system.d \
		-Dgtk-doc=false \
		-Dintrospection=true \
		$_arch_opts \
		build
	meson compile -C build
}

check() {
	meson test --no-rebuild --print-errorlogs -C build
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C build
}

sha512sums="
2300fca3c088f1bef29ecf1b5c82f6e91fcf886f3aa9ce1e53054e0c430fb3fc810ae8f580469a7975942c5a4852c75bac123a58c7c389d0ef116dc324d6463c  geoclue-2.7.2.tar.bz2
"
